package com.shengxing.lljl.config;


import org.springframework.context.annotation.Bean;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * 配置Swagger2
 * @author zhou
 */
//@Configuration
//@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket api(){
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.shengxing.lljl.controller"))
                .paths(PathSelectors.any())
                .build();
    }
//    @Bean
//    public Docket docket() {
//        Docket docket = new Docket(DocumentationType.SWAGGER_2)
//                .apiInfo(apiInfo()).enable(true)
//                .select()
//                .apis(RequestHandlerSelectors.basePackage("com.shengxing.lljl.controller"))
//                .paths(PathSelectors.any())
//                .build();
//        return docket;
//    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("Springfox Swagger2 Example")
                .description("This is an example of using Springfox Swagger2 to generate API documentation.")
                .version("1.0")
                .build();
    }

}
